home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / ol / readme.txt < prev    next >
Text File  |  1993-07-22  |  10KB  |  250 lines

  1.  
  2. OL(P): Object Layer for Prolog -- README
  3. Version 1.1 for SICStus Prolog and QUINTUS Prolog
  4.  
  5.   Copyright (c) 1993 Markus P.J. Fromherz.  All Rights Reserved.
  6.   Copyright (c) 1993 Xerox Corporation.  All Rights Reserved.
  7.  
  8.   Use, reproduction, preparation of derivative works, and distribution
  9.   of this software is permitted, but only for non-commercial research or
  10.   educational purposes. Any copy of this software or of any derivative
  11.   work must include both the above copyright notices of Markus P.J.
  12.   Fromherz and Xerox Corporation and this paragraph.  Any distribution
  13.   of this software or derivative works must comply with all applicable
  14.   United States export control laws. This software is made available AS
  15.   IS, and XEROX CORPORATION DISCLAIMS ALL WARRANTIES, EXPRESS OR
  16.   IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF
  17.   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND
  18.   NOTWITHSTANDING ANY OTHER PROVISION CONTAINED HEREIN, ANY LIABILITY
  19.   FOR DAMAGES RESULTING FROM THE SOFTWARE OR ITS USE IS EXPRESSLY
  20.   DISCLAIMED, WHETHER ARISING IN CONTRACT, TORT (INCLUDING NEGLIGENCE)
  21.   OR STRICT LIABILITY, EVEN IF XEROX CORPORATION IS ADVISED OF THE
  22.   POSSIBILITY OF SUCH DAMAGES.
  23.  
  24.   This copyright notice applies to all Object Layer software in this
  25.   release (sources, libraries, demos, and documentation).
  26.  
  27. Author: Markus P.J. Fromherz
  28.  
  29. Please send comments and bug reports to <fromherz@parc.xerox.com>.
  30. Please note that I will try to help, but can't guarantee anything.
  31.  
  32.  
  33. Table of contents of this file:
  34.  
  35.    1. Installation of the OL(P) System
  36.    2. First Use
  37.    3. Base Language Configuration
  38.    4. Dictories and Files
  39.  
  40.  
  41. 1. Installation of the OL(P) System
  42. -----------------------------------
  43.  
  44. OL(P) has been prepared for both SICStus Prolog and QUINTUS Prolog on
  45. a UNIX system. OL(P) can be used for other Prolog systems and on other
  46. platforms, but some changes may be necessary.
  47.  
  48. It is assumed that you get OL(P) in a compressed tar file `ol.tar.Z'.
  49.  
  50. a. Create a directory where you want to install OL(P), move the tar file
  51.    there, cd there, and uncompress and extract the file's contents:
  52.       mkdir /import/prolog/ol          % for example
  53.       mv ol.tar.Z /import/prolog/ol
  54.       cd /import/prolog/ol
  55.       uncompress ol.tar
  56.       tar xf ol.tar
  57.  
  58. b. In the file `Makefile' in the OL(P) directory, change the settings
  59.    of the the following variables:
  60.    - for all Prolog versions:
  61.        OL        path to the OL(P) directory
  62.        OLBIN     path and name of executable file
  63.    - for your Prolog version (SICStus 0.6, SICStus 2.1, Quintus):
  64.        PROLOG    path to your Prolog
  65.        PROLOPTS  compile flag (SICStus Prolog: `prolog_flag/3'
  66.                  for `compiling')
  67.        further flags: make sure the section for your Prolog version
  68.                       is not in comments (`#'), while the other two are
  69.  
  70.    For QUINTUS Prolog users:
  71.    In the file `src/ol_resource.rc', look for the fact `ol_prolog'.
  72.    Make the appropriate change for your Prolog version (take its line
  73.    out of comment, put the other into comment).
  74.  
  75.    Then, to build the OL(P) system, type (in the OL(P) directory):
  76.       make all
  77.    (This compiles all source files and creates a saved state `ol' in the `bin/'
  78.    directory. This also compiles the libraries and demo programs.)
  79.  
  80. c. Remove the tar file and - depending on your import or library package
  81.    organization - setup a link from your `bin/' directory to the executable
  82.    binary `ol':
  83.       rm ol.tar
  84.       ln -s /import/prolog/ol/bin/ol ~/bin/ol          % for example
  85.  
  86. d. The file `User-Manual' in doc/ explains how to use the OL(P) system.
  87.    If you want to reinstall OL(P) (e.g., after you made changes to the resource
  88.    file; see below), simply `make ol' in the OL(P) directory.
  89.    If you want to remove all files created by the installation (i.e. return to
  90.    the state right after the extraction from the tar file), `make clean' in the
  91.    OL(P) directory.
  92.  
  93.  
  94. 2. First Use
  95. ------------
  96.  
  97. Note that the library `gmlib' is not available for QUINTUS Prolog, and
  98. that the following example will not run for QUINTUS Prolog. Try the
  99. examples in the `User-Manual' instead.
  100.  
  101. The following is a sample use of a demo program. You will run it, then
  102. change it, compile, reload it, and run it again. This is for people
  103. who don't want to read the documentation first, but instead want to
  104. get a feeling for the use of the OL(P) system. See the `User-Manual'
  105. for more information. The installation steps above have to be
  106. completed. (If you don't have the GM library installed, you can use
  107. the `manual_pro' examples instead: start OL(P), switch to
  108. `manual_pro', and consult it as shown below, then try the sample
  109. queries. See also the `User-Manual'.)
  110.  
  111. In a shell, change directory to OL(P)'s demo/ directory. Then type
  112. after the prompts (the text in between is omitted):
  113.  
  114.    % ../bin/ol
  115.    | ?- project::switch(sort_pro).
  116.    | ?- project::do(consult(_)).
  117.    | ?- sort_interface::start.
  118.  
  119.  (The first command starts Prolog together with OL(P). The second command
  120.  sends a message to `project' to load the project data of `sort_pro'. Then,
  121.  its file and the libraries are consulted. Finally, the start message is
  122.  sent to object `sort_interface'. Method `help' in object `project' gives
  123.  you more information about these methods.)
  124.  
  125. Play with buttons and slider in the upcoming dialog window. Note how
  126. when you press `Sort', a message is displayed in the shell window.
  127. Finish by pressing `Quit'.
  128. Open file demo/sort_interface.pl.ol, search for method `handle_event/5'
  129. and there for the last-but-one clause. This clause is in comments;
  130. remove the `%' in front of this clause and save the file.  Back in the
  131. (Prolog) shell, type after the prompts:
  132.  
  133.    | ?- project::(compile, do(consult)).
  134.    | ?- sort_interface::start.
  135.  
  136.  (This compiles and consults the project's file, and starts the interface
  137.  again.)
  138.  
  139. Add some numbers and see how this time the `Sort' button works.
  140.  
  141.  
  142. 3. Base Language Configuration
  143. ------------------------------
  144.  
  145. OL(P) can be used for Prolog and Prolog variants. The inclusive
  146. condition is that - within an object - clauses in the base language
  147. are translated to clauses with bodies separated from the head by `:-'.
  148. Furthermore, any argument expansion has to be done before handing the
  149. clause to the OL(P) compiler. Terms outside of objects are copied
  150. without change. The notation should not conflict with that of OL(P).
  151. Further compilation after that of OL(P) is also possible.
  152.    Typically, these can be languages that are expanded to Prolog,
  153. e.g., a language that allows functional expressions, arrays or
  154. attribute-value lists, concurrency, or constraint satisfaction.
  155.  
  156. OL(P) compiles the body of a clause by expanding object-oriented goals
  157. `Object::Message'. What constitutes a goal in a particular language
  158. can be defined in the resource file `ol_resource.rc'. The resource
  159. file defines a fact
  160.  
  161.    ol_prolog(Prolog).
  162.  
  163. facts
  164.  
  165.    ol_read(BaseLanguage, InStream, PrologTerm, Init, ReadGoal)
  166.  
  167. and a number of facts
  168.  
  169.    ol_meta_predicate(Prolog, BaseLanguage, MetaPredicate).
  170.  
  171. (see there).
  172.  
  173.    `Prolog' denotes the current Prolog system and is set to
  174. `sicstusProlog' in `ol_prolog/1'. Make the appropriate change. For
  175. common meta-predicates (such as `,/2', `call/1' etc.), `Prolog' can be
  176. anonymous in `ol_meta_predicate/3'.
  177.    `BaseLanguage' is the suffix for the base language (e.g., `pl' for
  178. Prolog).  Again, for common meta-predicates (such as `,/2', `call/1'
  179. etc.), it can be anonymous.
  180.    `MetaPredicate' is the specification of a meta-predicate that
  181. contains goals.
  182.    Other arguments are explained in the resource file.
  183.  
  184. The specification `ol_meta_predicate/3' defines for each of the
  185. arguments whether it holds a goal or not. Goals are denoted by `::',
  186. other terms by `-'. For example, the specification `(::,::)' says that
  187. both arguments of the conjunction are goals, while the specification
  188. `findall(-,::,-)' says that the second argument of `findall/3' is a
  189. goal.
  190.  
  191. This specification extends to messages. Using the same specification,
  192. `O::(A,B)' is interpreted as `O::A, O::B', `::findall(X,M,L)' as
  193. `findall(X,::M,L)', `O::findall(X,(a(X);b(X)),L)' as
  194. `findall(X,(O::a(X);O::b(X)),L)' etc.
  195.  
  196. OL(P) determines the base language of a file's objects by the file's
  197. suffix.  Thus, if the OL(P) file is called `File.pl.ol', the
  198. meta-predicate specifications for `pl' are used, and a file `File.pl'
  199. is produced on compilation.
  200.  
  201. If you change the resource file, make a new OL(P) system (`make ol' as
  202. in the Installation).
  203.  
  204.  
  205. 4. Dictories and Files
  206. ----------------------
  207.  
  208. README
  209.       This file.
  210.  
  211. Release-Notes
  212.       Information on how to get OL(P), and on recent changes.
  213.  
  214. Makefile
  215.       The make file for setting up the OL(P) system in the current
  216.       directory. See Installation.
  217.  
  218. quintus.ini, sicstus0.6.ini
  219.       Files needed for QUINTUS Prolog and for SICStus Prolog 0.6
  220.       installation.
  221.  
  222. src/
  223.       The directory containing the source files for the OL(P) system,
  224.       and a make file `Makefile' used by the above `Makefile'. Note
  225.       that all files needed for a run-time version of OL(P) have a
  226.       name starting with `ol_'.
  227.  
  228. bin/
  229.       The directory containing `ol' (a saved Prolog state with the
  230.       loaded OL(P) system), and `ol.pl' (a Prolog file that loads the
  231.       OL(P) system when consulted). See Installation.
  232.  
  233. lib/
  234.       The directory containing some libraries for lists, integers,
  235.       meta-programming, and an user interface framework.
  236.  
  237. doc/
  238.       The directory containing the documentation for the OL(P) system.
  239.       The file `User-Manual' explains OL(P) constructs and the use of
  240.       the OL(P) system. The file `Reference-Manual' documents the
  241.       system objects.
  242.  
  243. demo/
  244.  
  245.       The directory containing demo programs, including project
  246.       `manual_pro' (programs from the User-Manual), library
  247.       `listener_lib' (simple tracing meta-interpreter), and a sample
  248.       use of the user interface framework (`sort_pro'). Note that
  249.       the latter needed library gmlib.
  250.